package com.WaVel.mapper;

import com.Emplyment.dto.CategoryDto;
import com.Emplyment.entity.EmplymentCategory;
import com.Emplyment.enumeration.OperationType;
import com.WaVel.annotation.AutoFill;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

@Mapper
public interface CategoryMapper {

    /**
     * 查询所有公司分类数据
     */
    List<EmplymentCategory> SearchAllEmplymentCategory();


    EmplymentCategory SearchEmplymentCategory(CategoryDto categoryDto);

    /**
     * 添加公司分类
     * @param emplymentCategory
     */
    @Insert("insert into category (categoryName, categoryAlias, createTime, updateTime)VALUES " +
            "(#{categoryName},#{categoryAlias},#{createTime},#{updateTime})")
    @AutoFill(value = OperationType.INSERT)
    void addEmplymentCategory(EmplymentCategory emplymentCategory);


    /**
     * 修改公司分类
     * @param emplymentCategory
     */
    @AutoFill(value = OperationType.UPDATE)
    void UpdataEmplymentCategory(EmplymentCategory emplymentCategory);


    /**
     * 根据id删除公司分类
     * @param id
     */
    @Delete("delete from category where id = #{id}")
    void DelectEmplymentCategory(int id);
}
